<?php
/**
 * 行业类目模型
 */

namespace app\common\model;

use think\model\concern\SoftDelete;

class Cate extends CommonBaseModel {
	use SoftDelete;
	// 自定义选择数据
	const STATUS_LIST = [
		0 => '禁用',
		1 => '启用',
	];
	protected $name = 'cate';
	protected $autoWriteTimestamp = true;

	// 可搜索字段
	public array $searchField = ['name'];

	// 可作为条件的字段
	public array $whereField = ['status'];

	// 可作为多选条件的字段
	public array $multiWhereField = [];

	// 可做为时间
	public array $timeField = [];

	public function getStatusNameAttr($value, $data) {
		return self::STATUS_LIST[$data['status']];
	}

	/**
	 * 关联
	 */
	public function apply() {
		return $this->hasMany(Apply::class);
	}/**
	 * 关联
	 */
	public function project() {
		return $this->hasMany(Project::class);
	}

}
